package com.guoju.tyframework.mvc.action;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

import javax.servlet.http.HttpServletRequest;

import com.guoju.tyframework.mvc.config.MvcBeans;
import com.guoju.tyframework.mvc.context.FullActionParams;

public class ActionHandler implements InvocationHandler {
	Action action;
	
	public ActionHandler() {
	}

	public ActionHandler(Action action) {
		this.action = action;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		Object o=null;
		System.err.println("aop-pre");
		action=FullActionParams.ioc(action, (MvcBeans)args[0],(HttpServletRequest)args[2]);
		o=method.invoke(action, args);
		System.err.println("aop-suffix");
		return o;
	}

	public static void main(String[] args) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
		
	}
}
